<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Easy
  </div>
  <div>
   <h1 class="question_title">
    1027. Sum of Even Numbers After Queries
   </h1>
   <p>
    We have an array
    <code>
     A
    </code>
    of integers, and an array
    <code>
     queries
    </code>
    &nbsp;of queries.
   </p>
   <p>
    For the
    <code>
     i
    </code>
    -th&nbsp;query
    <code>
     val =&nbsp;queries[i][0], index&nbsp;= queries[i][1]
    </code>
    , we add
    <font face="monospace">
     val
    </font>
    &nbsp;to
    <code>
     A[index]
    </code>
    .&nbsp; Then, the answer to the
    <code>
     i
    </code>
    -th query is the sum of the even values of
    <code>
     A
    </code>
    .
   </p>
   <p>
    <em>
     (Here, the given
     <code>
      index = queries[i][1]
     </code>
     is a 0-based index, and each query permanently modifies the array
     <code>
      A
     </code>
     .)
    </em>
   </p>
   <p>
    Return the answer to all queries.&nbsp; Your
    <code>
     answer
    </code>
    array should have&nbsp;
    <code>
     answer[i]
    </code>
    &nbsp;as&nbsp;the answer to the
    <code>
     i
    </code>
    -th query.
   </p>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     Example 1:
    </strong>
   </p>
   <pre>
<strong>Input: </strong>A = <span id="example-input-1-1">[1,2,3,4]</span>, queries = <span id="example-input-1-2">[[1,0],[-3,1],[-4,0],[2,3]]</span>
<strong>Output: </strong><span id="example-output-1">[8,6,2,4]</span>
<strong>Explanation: </strong>
At the beginning, the array is [1,2,3,4].
After adding 1 to A[0], the array is [2,2,3,4], and the sum of even values is 2 + 2 + 4 = 8.
After adding -3 to A[1], the array is [2,-1,3,4], and the sum of even values is 2 + 4 = 6.
After adding -4 to A[0], the array is [-2,-1,3,4], and the sum of even values is -2 + 4 = 2.
After adding 2 to A[3], the array is [-2,-1,3,6], and the sum of even values is -2 + 6 = 4.
</pre>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     Note:
    </strong>
   </p>
   <ol>
    <li>
     <code>
      1 &lt;= A.length &lt;= 10000
     </code>
    </li>
    <li>
     <code>
      -10000 &lt;= A[i] &lt;= 10000
     </code>
    </li>
    <li>
     <code>
      1 &lt;= queries.length &lt;= 10000
     </code>
    </li>
    <li>
     <code>
      -10000 &lt;= queries[i][0] &lt;= 10000
     </code>
    </li>
    <li>
     <code>
      0 &lt;= queries[i][1] &lt; A.length
     </code>
    </li>
   </ol>
  </div>
  <div>
   <h1 class="question_title">
    1027. 查询后的偶数和
   </h1>
   <p>
    给出一个整数数组&nbsp;
    <code>
     A
    </code>
    &nbsp;和一个查询数组&nbsp;
    <code>
     queries
    </code>
    。
   </p>
   <p>
    对于第&nbsp;
    <code>
     i
    </code>
    &nbsp;次查询，有&nbsp;
    <code>
     val =&nbsp;queries[i][0], index&nbsp;= queries[i][1]
    </code>
    ，我们会把&nbsp;
    <code>
     val
    </code>
    &nbsp;加到&nbsp;
    <code>
     A[index]
    </code>
    &nbsp;上。然后，第&nbsp;
    <code>
     i
    </code>
    &nbsp;次查询的答案是
    <code>
     A
    </code>
    中偶数值的和。
   </p>
   <p>
    <em>
     （此处给定的&nbsp;
     <code>
      index = queries[i][1]
     </code>
     &nbsp;是从 0 开始的索引，每次查询都会永久修改数组&nbsp;
     <code>
      A
     </code>
     。）
    </em>
   </p>
   <p>
    返回所有查询的答案。你的答案应当以数组&nbsp;
    <code>
     answer
    </code>
    &nbsp;给出，
    <code>
     answer[i]
    </code>
    &nbsp;为第&nbsp;
    <code>
     i
    </code>
    &nbsp;次查询的答案。
   </p>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     示例：
    </strong>
   </p>
   <pre><strong>输入：</strong>A = [1,2,3,4], queries = [[1,0],[-3,1],[-4,0],[2,3]]
<strong>输出：</strong>[8,6,2,4]
<strong>解释：</strong>
开始时，数组为 [1,2,3,4]。
将 1 加到 A[0] 上之后，数组为 [2,2,3,4]，偶数值之和为 2 + 2 + 4 = 8。
将 -3 加到 A[1] 上之后，数组为 [2,-1,3,4]，偶数值之和为 2 + 4 = 6。
将 -4 加到 A[0] 上之后，数组为 [-2,-1,3,4]，偶数值之和为 -2 + 4 = 2。
将 2 加到 A[3] 上之后，数组为 [-2,-1,3,6]，偶数值之和为 -2 + 6 = 4。
</pre>
   <p>
    &nbsp;
   </p>
   <p>
    <strong>
     提示：
    </strong>
   </p>
   <ol>
    <li>
     <code>
      1 &lt;= A.length &lt;= 10000
     </code>
    </li>
    <li>
     <code>
      -10000 &lt;= A[i] &lt;= 10000
     </code>
    </li>
    <li>
     <code>
      1 &lt;= queries.length &lt;= 10000
     </code>
    </li>
    <li>
     <code>
      -10000 &lt;= queries[i][0] &lt;= 10000
     </code>
    </li>
    <li>
     <code>
      0 &lt;= queries[i][1] &lt; A.length
     </code>
    </li>
   </ol>
  </div>
 </body>
</html>